from sqlalchemy import Date, DateTime, Index, String, Text, text, Column, Integer, Float, CHAR
from sqlalchemy.dialects.mysql import DECIMAL

from mooc.db.database import Base


class Advert(Base):
    __tablename__ = 'ims_goouc_fullexam_advert'
    __table_args__ = (
        Index('idx_weid', 'weid'),
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False, server_default=text("'0'"))
    homeId = Column(String(255), nullable=True, comment='首页广告id')
    secondId = Column(String(255), nullable=True, comment='解析页广告id')
    createtime = Column(Integer, nullable=True, comment='创建时间')

    class Config:
        orm_mode = True


class Banji(Base):
    __tablename__ = 'ims_goouc_fullexam_banji'

    banji_id = Column(Integer, primary_key=True, index=True)
    uidht = Column(Integer, nullable=False)
    school_id = Column(Integer, nullable=False)
    nianfen_id = Column(Integer, nullable=False)
    xdgl_id = Column(Integer, nullable=False)
    nid = Column(Integer, nullable=False)
    name = Column(String(50), nullable=False)
    bname = Column(String(50), nullable=False)
    parentid = Column(Integer, nullable=False)
    displayorder = Column(Integer, nullable=False)
    enabled = Column(Integer, nullable=False)
    icon = Column(String(100), nullable=False)
    banjikouhao = Column(String(100), nullable=False)
    banxun = Column(String(100), nullable=False)
    banjimubiao = Column(String(100), nullable=False)
    bzrjy = Column(String(200), nullable=False)
    description = Column(String(200), nullable=False)
    styleid = Column(Integer, nullable=False)
    linkurl = Column(String(500), nullable=False)
    ishomepage = Column(Integer, nullable=False)
    icontype = Column(Integer, nullable=False)
    css = Column(String(500), nullable=False)
    weid = Column(Integer, nullable=True)
    status = Column(Integer, nullable=False, server_default=text("'0'"))

    class Config:
        orm_mode = True


class Banner(Base):
    __tablename__ = 'ims_goouc_fullexam_banner'
    __table_args__ = (
        Index('idx_weid', 'weid'),
        {'comment': '轮播图表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    title = Column(String(255), nullable=False)
    image = Column(String(255), nullable=False, comment='图片路径')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    type = Column(Integer, nullable=False, server_default=text("'1'"), comment='图片跳转方式 1本程序跳转  2外部链接')
    link = Column(Text, nullable=True, comment='链接')
    status = Column(Integer, nullable=False, server_default=text("'2'"), comment='图片状态 1 显示 2 不显示')
    istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识')

    class Config:
        orm_mode = True


class Category(Base):
    __tablename__ = 'ims_goouc_fullexam_category'
    __table_args__ = (
        Index('idx_name', 'name'),
        Index('idx_weid', 'weid'),
        {'comment': '分类表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    name = Column(String(255), nullable=False, comment='分类名称')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    pid = Column(String(255), nullable=False, server_default=text("'0'"), comment='分类父级 默认为顶级分类')
    order = Column(Integer, nullable=False, server_default=text("'0'"), comment='分类序号  默认为0')
    status = Column(Integer, nullable=False, server_default=text("'1'"), comment='分类核状态 1 显示 2不显示')
    istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识')

    class Config:
        orm_mode = True


class Cdkey(Base):
    __tablename__ = 'ims_goouc_fullexam_cdkey'
    __table_args__ = (
        Index('idx_cid', 'cid'),
        Index('idx_weid', 'weid'),
        {'comment': '兑换码'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False, server_default=text("'0'"))
    cid = Column(Integer, nullable=False, server_default=text("'0'"))
    uid = Column(Integer, nullable=False, server_default=text("'0'"), comment='用户id 0未领取')
    display = Column(Integer, nullable=False, server_default=text("'1'"), comment='1启用 2作废')
    code = Column(String(255), nullable=True, comment='题库')
    createtime = Column(Integer, nullable=True, comment='时间')
    usetime = Column(Integer, nullable=True, comment='时间')
    status = Column(Integer, nullable=True, server_default=text("'1'"), comment='状态 1未使用 2已使用')
    kpool = Column(String(2000), nullable=True, comment='到期时间')
    day_num = Column(Integer, nullable=True, comment='激活天数')
    endtime = Column(Integer, nullable=True)

    class Config:
        orm_mode = True


class CdkeyCate(Base):
    __tablename__ = 'ims_goouc_fullexam_cdkey_cate'
    __table_args__ = (
        Index('idx_weid', 'weid'),
        {'comment': '兑换码'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False, server_default=text("'0'"))
    title = Column(String(255), nullable=False)
    papers = Column(String(2000), nullable=False, comment='试卷ids')
    createtime = Column(Integer, nullable=True, comment='时间')
    qpool = Column(String(2000), nullable=True, comment='题库')
    kpool = Column(String(2000), nullable=True, comment='知识库')
    msg = Column(String(255), nullable=True, comment='提示信息')
    status = Column(Integer, nullable=False, server_default=text("'1'"), comment='状态 1启用 2禁用')
    is_delete = Column(Integer, nullable=False, server_default=text("'1'"), comment='状态 1正常 2删除')

    class Config:
        orm_mode = True


class Cdkeys(Base):
    __tablename__ = 'ims_goouc_fullexam_cdkeys'
    __table_args__ = (
        Index('idx_code_id', 'code_id'),
        Index('idx_kpool_id', 'kpool_id'),
        Index('idx_weid', 'weid'),
        {'comment': '兑换码-题库表'}
    )
    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False, server_default=text("'0'"))
    code_id = Column(Integer, nullable=False, server_default=text("'0'"))
    kpool_id = Column(Integer, nullable=False, server_default=text("'0'"), comment='绑定')
    type = Column(Integer, nullable=False, server_default=text("'0'"), comment='绑定类型 1 试卷 2题库')

    class Config:
        orm_mode = True


class Exercise(Base):
    __tablename__ = 'ims_goouc_fullexam_exercise'
    __table_args__ = (
        Index('idx_weid', 'weid'),
        {'comment': '记录练习做的每道题'}
    )

    id = Column(Integer, primary_key=True, index=True)
    uid = Column(Integer, nullable=False)
    testid = Column(Integer, nullable=False)
    isright = Column(Integer, nullable=False)
    weid = Column(Integer, nullable=True, server_default=text("'0'"))
    test_type = Column(Integer, nullable=True)
    uanswer = Column(String(255), nullable=True)
    istatus = Column(Integer, nullable=False, server_default=text("'1'"))
    createtime = Column(Integer, nullable=True, comment='创建时间')

    class Config:
        orm_mode = True


class Feedback(Base):
    __tablename__ = 'ims_goouc_fullexam_feedback'
    __table_args__ = (
        Index('idx_weid', 'weid'),
        {'comment': '反馈表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    uid = Column(Integer, nullable=False)
    weid = Column(Integer, nullable=True, server_default=text("'0'"))
    testid = Column(Integer, nullable=True)
    relation = Column(String(255), nullable=True)
    content = Column(Text, nullable=True)
    istatus = Column(Integer, nullable=False, server_default=text("'1'"))
    createtime = Column(Integer, nullable=True, comment='时间')

    class Config:
        orm_mode = True


class Gift(Base):
    __tablename__ = 'ims_goouc_fullexam_gift'
    __table_args__ = (
        Index('idx_weid', 'weid'),
    )

    id = Column(Integer, primary_key=True, index=True, comment='礼品id')
    weid = Column(Integer, nullable=False, server_default=text("'0'"))
    name = Column(String(100), nullable=False, comment='礼品名称')
    price = Column(Integer, nullable=False, server_default=text("'100'"), comment='礼品市场价格')
    coins = Column(Integer, nullable=False, server_default=text("'500'"), comment='礼品所需金币')
    image = Column(String(255), nullable=False, comment='礼品图片')
    about = Column(Text, nullable=False)

    class Config:
        orm_mode = True


class IndexBtn(Base):
    __tablename__ = 'ims_goouc_fullexam_index_btn'
    __table_args__ = (
        Index('idx_weid', 'weid'),
        {'comment': '菜单按钮表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False, server_default=text("'0'"))
    doid = Column(Integer, nullable=False, server_default=text("'0'"))
    title = Column(String(255), nullable=False)
    types = Column(Integer, nullable=False, server_default=text("'1'"), comment='1模块功能 2题库')
    library_id = Column(Integer, nullable=False)
    icon = Column(String(255), nullable=True, comment='图片路径')
    status = Column(Integer, nullable=False, server_default=text("'1'"), comment='图片状态 1 显示 2 不显示')
    sort = Column(Integer, nullable=False, server_default=text("'0'"), comment='排序')

    class Config:
        orm_mode = True


class Knowledge(Base):
    __tablename__ = 'ims_goouc_fullexam_knowledge'
    __table_args__ = (
        Index('idx_weid', 'weid'),
        {'comment': '知识点'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    title = Column(String(255), nullable=False)
    content = Column(Text, nullable=False, comment='公告内容')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    one = Column(Integer, nullable=True, server_default=text("'0'"), comment='分类1')
    two = Column(Integer, nullable=True, server_default=text("'0'"), comment='分类2')
    three = Column(Integer, nullable=True, server_default=text("'0'"), comment='分类3')
    status = Column(Integer, nullable=False, server_default=text("'2'"), comment='状态 1显示 2不显示')
    istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识')

    class Config:
        orm_mode = True


class KnowledgeCate(Base):
    __tablename__ = 'ims_goouc_fullexam_knowledge_cate'
    __table_args__ = (
        Index('idx_weid', 'weid'),
        {'comment': '知识点分类表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    name = Column(String(255), nullable=False, comment='知识点名称')
    create_time = Column(Integer, nullable=False, comment='创建时间')
    type = Column(Integer, nullable=True, server_default=text("'1'"), comment='分类 1刷知识点 2考前必备')
    pid = Column(Integer, nullable=True, server_default=text("'0'"), comment='默认0为顶级分类')
    istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识')
    status = Column(Integer, nullable=False, server_default=text("'1'"), comment='显示隐藏')
    price = Column(DECIMAL(10, 2), nullable=True, server_default=text("'0.00'"))

    class Config:
        orm_mode = True


class Notice(Base):
    __tablename__ = 'ims_goouc_fullexam_notice'
    __table_args__ = (
        Index('idx_type', 'type'),
        Index('idx_weid', 'weid'),
        {'comment': '公告表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    type = Column(Integer, nullable=False, comment='公告类型')
    title = Column(String(255), nullable=False, comment='公告标题')
    content = Column(Text, nullable=False, comment='公告内容')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    image = Column(String(255), nullable=True, comment='活动公告的图片')
    readnum = Column(Integer, nullable=True, server_default=text("'0'"), comment='阅读量')
    status = Column(Integer, nullable=False, server_default=text("'2'"), comment='公告状态 1 显示 2 不显示')
    istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识')
    video_audio_id = Column(String(255), nullable=True, comment='音/视频ID')
    pcate = Column(Integer, nullable=True, comment='文章所属分类')
    ccate = Column(Integer, nullable=True, comment='文章所属子分类')
    article_type = Column(Integer, nullable=True, comment='文章的类型1文章2视频')

    class Config:
        orm_mode = True


class Order(Base):
    __tablename__ = 'ims_goouc_fullexam_order'
    __table_args__ = (
        Index('idx_dataid', 'dataid'),
        Index('idx_out_trade_no', 'out_trade_no'),
        Index('idx_transaction_sn', 'transaction_sn'),
        Index('idx_weid', 'weid')
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    type = Column(Integer, nullable=False, comment='购买类型 1购买考试 2VIP购买')
    out_trade_no = Column(String(255), nullable=False)
    userid = Column(Integer, nullable=False)
    order_status = Column(Integer, nullable=False, comment='订单状态 0未支付1已支付')
    all_money = Column(DECIMAL(10, 2), nullable=False, server_default=text("'0.00'"), comment='总金额')
    true_money = Column(DECIMAL(10, 2), nullable=False, comment='实付款')
    createtime = Column(Integer, nullable=False)
    openid = Column(String(255), nullable=True, comment='购买者的openid')
    paytime = Column(Integer, nullable=True)
    msg = Column(String(255), nullable=True)
    dataid = Column(Integer, nullable=True)
    transaction_sn = Column(String(255), nullable=True, comment='第三方流水号')
    istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='订单删除标识')

    class Config:
        orm_mode = True


class Paper(Base):
    __tablename__ = 'ims_goouc_fullexam_paper'
    __table_args__ = (
        Index('idx_status', 'status'),
        Index('idx_type', 'type'),
        Index('idx_weid', 'weid'),
        {'comment': '试卷表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    title = Column(String(255), nullable=False, comment='试卷标题')
    franction = Column(Text, nullable=False, comment='每个题型有多少  每个题多少分')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    price = Column(DECIMAL(10, 2), nullable=False, server_default=text("'0.00'"), comment='试卷价格默认0')
    times = Column(Integer, nullable=False, comment='试卷时间单位分')
    is_repeat = Column(Integer, nullable=False, server_default=text("'2'"), comment='重复答题 1可以 2否')
    type = Column(Integer, nullable=True, server_default=text("'1'"), comment='试卷类型')
    total_franction = Column(Integer, nullable=True, server_default=text("'0'"), comment='试卷总分值')
    status = Column(Integer, nullable=True, server_default=text("'2'"),
                    comment='试卷状态 默认为2 待完善试卷 1 已完善试卷')
    istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识')
    dnum = Column(Integer, nullable=True, server_default=text("'0'"), comment='做题人数')
    displayorder = Column(Integer, nullable=True, server_default=text("'0'"), comment='显示顺序')

    class Config:
        orm_mode = True


class PaperTest(Base):
    __tablename__ = 'ims_goouc_fullexam_paper_test'
    __table_args__ = (
        Index('idx_paperid', 'paperid'),
        Index('idx_weid', 'weid'),
        {'comment': '试卷试题表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    paperid = Column(String(255), nullable=False, comment='试卷标题')
    testid = Column(Integer, nullable=False, comment='试题ID')
    test_type = Column(Integer, nullable=False, comment='题型类型')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    istatus = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否删除的标识')

    class Config:
        orm_mode = True


class Phonecode(Base):
    __tablename__ = 'ims_goouc_fullexam_phonecode'
    __table_args__ = (
        Index('idx_phone', 'phone'),
        {'comment': '手机发送验证码'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    phone = Column(String(11), nullable=False)
    code = Column(Integer, nullable=False, comment='手机验证码')
    createtime = Column(Integer, nullable=False)

    class Config:
        orm_mode = True


class QYear(Base):
    __tablename__ = 'ims_goouc_fullexam_q_year'
    __table_args__ = (
        Index('idx_name', 'name'),
        Index('idx_weid', 'weid'),
        {'comment': '试题年份表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    name = Column(String(255), nullable=False, comment='年份名称')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    status = Column(Integer, nullable=True, server_default=text("'1'"), comment='状态 1 显示 2不显示')
    istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识')

    class Config:
        orm_mode = True


class School(Base):
    __tablename__ = 'ims_goouc_fullexam_school'

    school_id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=True)
    school_name = Column(String(200), nullable=True)
    school_logo = Column(String(200), nullable=True)
    school_info_intro = Column(Text, nullable=True, comment='学校描述')
    addtime = Column(Integer, nullable=True)
    mu_str = Column(String(30), nullable=True)
    status = Column(Integer, nullable=True, server_default=text("'1'"))
    line_status = Column(Integer, nullable=True, server_default=text("'1'"))
    cookbook_status = Column(Integer, nullable=True, server_default=text("'1'"))
    class_notice_status = Column(Integer, nullable=True, server_default=text("'1'"),
                                 comment='班级公告是否需要审核；1=》不需要；2=》需要')
    school_type = Column(Integer, nullable=True, server_default=text("'0'"))
    host_url = Column(Text, nullable=True, comment='官网地址')
    on_school = Column(Integer, nullable=True, server_default=text("'0'"), comment='在校天数')
    begin_day = Column(Integer, nullable=True, server_default=text("'0'"), comment='开始上课周数')
    am_much = Column(Integer, nullable=True, server_default=text("'0'"), comment='上午课数')
    pm_much = Column(Integer, nullable=True, server_default=text("'0'"), comment='下午课数')
    ye_much = Column(Integer, nullable=True, server_default=text("'0'"), comment='晚上课数')
    line_type = Column(Text, nullable=True, comment='班级圈类别')
    appointment = Column(Text, nullable=True, comment='预约类别')
    parents = Column(Integer, nullable=True, server_default=text("'3'"), comment='学生可绑定家长数')
    add_time = Column(Integer, nullable=True, server_default=text("'0'"))

    class Config:
        orm_mode = True


class Setting(Base):
    __tablename__ = 'ims_goouc_fullexam_setting'
    __table_args__ = {'comment': '基础设置表'}

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    info_status = Column(Integer, nullable=False, server_default=text("'1'"), comment='是否必须完善信息1是')
    app_id = Column(String(50), nullable=False, comment='微信公众公众号Appid')
    app_secret = Column(String(50), nullable=False, comment='微信公众SERECT')
    IOS = Column(Integer, nullable=False, server_default=text("'2'"), comment='1开启 2关闭')
    customer_service = Column(String(255), nullable=False, comment='客服二维码')
    mchid = Column(String(50), nullable=True, comment='微信支付商户ID')
    pay_secret = Column(String(50), nullable=True, comment='支付密匙')
    pay_open = Column(Integer, nullable=True, server_default=text("'0'"), comment='支付开启 1开启')
    signcertpath = Column(String(255), nullable=True, comment='商户CERT证书路径')
    signkeypath = Column(String(255), nullable=True, comment='商户KEY证书路径')
    AccessKeyId = Column(String(255), nullable=True, comment='阿里云账号')
    AccessKeySecret = Column(String(255), nullable=True, comment='阿里云秘钥')
    SignName = Column(String(255), nullable=True, comment='阿里云短信签名')
    TemplateCode = Column(String(255), nullable=True, comment='阿里云验证码模板id')
    RegionId = Column(String(255), nullable=True, comment='阿里云视频点播区域名')
    banner_height = Column(Integer, nullable=True, server_default=text("'232'"), comment='轮播图高')
    shareupper = Column(Integer, nullable=True, server_default=text("'0'"), comment='每日分享获得积分上限')
    share_title = Column(String(255), nullable=True, comment='分享标题')
    istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识')
    is_display = Column(Integer, nullable=True, server_default=text("'1'"), comment='公告是否显示')
    display_num = Column(Integer, nullable=True, server_default=text("'5'"), comment='公告显示条数')
    use_integral_num = Column(Integer, nullable=True, comment='高频题消耗积分个数')
    franction = Column(Text, nullable=True, comment='每个题型有多少每题多少分')
    paper_time = Column(Integer, nullable=True, comment='考试时长单位(分)')
    reward_integral = Column(Integer, nullable=True, comment='答对一题奖励积分数量')
    medal = Column(Text, nullable=True, comment='勋章设置')
    share_integral = Column(Integer, nullable=True, comment='每次分享可得积分')
    sms_accessKeyId = Column(String(255), nullable=True, comment='短信accesskeyid')
    sms_accessKeySecret = Column(String(255), nullable=True, comment='短信accesskeysecret')
    about = Column(Text, nullable=True, comment='关于我们')
    wechat_number = Column(String(255), nullable=True, comment='商家微信号')
    standard = Column(Integer, nullable=True, server_default=text("'5'"), comment='每日答题达标数量')
    pass_ = Column('pass', String(255), nullable=True)
    good = Column(String(255), nullable=True)
    excellent = Column(String(255), nullable=True)
    randoms = Column(String(255), nullable=True)
    randoms_icon = Column(String(255), nullable=True)
    randoms_rule = Column(String(255), nullable=True)
    notdone = Column(String(255), nullable=True)
    notdone_icon = Column(String(255), nullable=True)
    notdone_rule = Column(String(255), nullable=True)
    qhig = Column(String(255), nullable=True)
    qhig_icon = Column(String(255), nullable=True)
    qhig_rule = Column(String(255), nullable=True)
    qint = Column(String(255), nullable=True)
    qint_icon = Column(String(255), nullable=True)
    qint_rule = Column(String(255), nullable=True)
    qhot = Column(String(255), nullable=True)
    qhot_icon = Column(String(255), nullable=True)
    qhot_rule = Column(String(255), nullable=True)
    qdiff = Column(String(255), nullable=True)
    qdiff_icon = Column(String(255), nullable=True)
    qdiff_rule = Column(String(255), nullable=True)
    countdown = Column(String(255), nullable=True, comment='事件名称')
    countdowntime = Column(DateTime, nullable=True, comment='时间点')
    time_display = Column(Integer, nullable=True, server_default=text("'1'"), comment='倒计时显示')
    student_open = Column(Integer, nullable=True, server_default=text("'1'"), comment='学生开启 1开启')
    freepoolnum = Column(Integer, nullable=True, server_default=text("'0'"), comment='题库体验题数')
    freeknowledgenum = Column(Integer, nullable=True, server_default=text("'0'"), comment='知识点体验章数')

    class Config:
        orm_mode = True


class ShareRecord(Base):
    __tablename__ = 'ims_goouc_fullexam_share_record'
    __table_args__ = (
        Index('idx_weid', 'weid'),
    )

    id = Column(Integer, primary_key=True, index=True)
    uid = Column(Integer, nullable=False)
    weid = Column(Integer, nullable=True, server_default=text("'0'"))
    num = Column(Integer, nullable=True)
    istatus = Column(Integer, nullable=True, server_default=text("'1'"))
    day = Column(Date, nullable=True, comment='记录哪一天')
    createtime = Column(Integer, nullable=True, comment='创建时间')

    class Config:
        orm_mode = True


class SonSimple(Base):
    __tablename__ = 'ims_goouc_fullexam_son_simple'

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(String(150), nullable=False)
    son_title = Column(String(255), nullable=False)

    class Config:
        orm_mode = True


class Test(Base):
    __tablename__ = 'ims_goouc_fullexam_test'
    __table_args__ = (
        Index('idx_type', 'type'),
        Index('idx_weid', 'weid'),
        {'comment': '试题表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    type = Column(Integer, nullable=False, comment='试题类型')
    title = Column(String(255), nullable=False, comment='试题题目 仅在列表显示 试卷内不显示')
    question = Column(Text, nullable=False, comment='题目')
    rightkey = Column(Text, nullable=False, comment='正确答案')
    analysis = Column(Text, nullable=False, comment='答案解析')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    son_simple = Column(Integer, nullable=False, server_default=text("'0'"))
    libraryid = Column(Integer, nullable=True, server_default=text("'0'"), comment='题库id')
    qimage = Column(Text, nullable=True, comment='试题图片')
    qaudio = Column(Text, nullable=True, comment='问题音频')
    a_type = Column(Integer, nullable=True, server_default=text("'0'"), comment='选项类型')
    option = Column(Text, nullable=True, comment='选项')
    aimage = Column(Text, nullable=True, comment='解析图片')
    istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识')
    anum = Column(Integer, nullable=True, server_default=text("'0'"), comment='本题答题次数 仅考试')
    rnum = Column(Integer, nullable=True, server_default=text("'0'"), comment='正确回答次数 仅考试')
    level = Column(Integer, nullable=True, server_default=text("'1'"), comment='难度等级')
    qvideo = Column(Text, nullable=True, comment='问题视频')
    analysis_audio = Column(Text, nullable=True, comment='音频解析')
    knowledge = Column(Text, nullable=True, comment='所属知识点类别')
    type_classification = Column(Text, nullable=True, comment='类型分类')
    q_year = Column(Text, nullable=True, comment='年份')
    pid = Column(Integer, nullable=True, server_default=text("'0'"), comment='问题父id')
    son_status = Column(Integer, nullable=True, comment='语音题是否加了小题')
    display = Column(Integer, nullable=True, server_default=text("'1'"), comment='1-显示2-不显示')

    class Config:
        orm_mode = True


class TestType(Base):
    __tablename__ = 'ims_goouc_fullexam_test_type'
    __table_args__ = (
        Index('idx_weid', 'weid'),
        {'comment': '试题库表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    name = Column(String(255), nullable=False, comment='试题库名称')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    display_order = Column(Integer, nullable=False, server_default=text("'0'"))
    pid = Column(Integer, nullable=True, server_default=text("'0'"), comment='默认0为顶级分类')
    gpid = Column(Integer, nullable=True, server_default=text("'0'"), comment='默认0')
    price = Column(DECIMAL(10, 2), nullable=True, server_default=text("'0.00'"))
    status = Column(Integer, nullable=True, server_default=text("'1'"), comment='题库状态')
    is_student = Column(Integer, nullable=True, server_default=text("'0'"), comment='学员专享 1是')
    istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识')

    class Config:
        orm_mode = True


class TypeCate(Base):
    __tablename__ = 'ims_goouc_fullexam_type_cate'
    __table_args__ = (
        Index('idx_name', 'name'),
        Index('idx_weid', 'weid'),
        {'comment': '类型分类表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    name = Column(String(255), nullable=False, comment='分类名称')
    createtime = Column(Integer, nullable=False, comment='创建时间')
    status = Column(Integer, nullable=True, server_default=text("'1'"), comment='状态 1 显示 2不显示')
    istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='是否删除的标识')

    class Config:
        orm_mode = True

class Watermark(Base):
    __tablename__ = 'ims_goouc_fullexam_watermark'
    __table_args__ = {'comment': '水印配置表'}

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    type = Column(Integer, nullable=False, comment='1个人信息 2为自定义')
    open = Column(Integer, nullable=False, server_default=text("'2'"), comment='1打开水印 2关闭水印')
    content = Column(String(1024), nullable=False, comment='水印内容')
    size = Column(Integer, nullable=False, comment='字体大小')
    rotate = Column(Integer, nullable=False, comment='旋转度数')
    transparent = Column(Integer, nullable=False, comment='透明度')
    local_type = Column(Integer, nullable=False, comment='1预设 2为自定义 生效位置类型')
    presupposition = Column(Integer, nullable=False, comment='预设类型')
    horizontal = Column(Integer, nullable=False, comment='水平距离')
    vertical = Column(Integer, nullable=False, comment='垂直距离')

    class Config:
        orm_mode = True


class Wxtpl(Base):
    __tablename__ = 'ims_goouc_fullexam_wxtpl'
    __table_args__ = (
        Index('idx_weid', 'weid'),
        {'comment': '模板消息表'}
    )

    id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    type = Column(Integer, nullable=False)
    tplid = Column(String(255), nullable=False)
    createtime = Column(Integer, nullable=False, comment='创建时间')
    keyword1 = Column(String(255), nullable=True)
    keyword2 = Column(String(255), nullable=True)
    keyword3 = Column(String(255), nullable=True)
    istatus = Column(Integer, nullable=True, server_default=text("'1'"), comment='删除状态')

    class Config:
        orm_mode = True


class Xuesheng(Base):
    __tablename__ = 'ims_goouc_fullexam_xuesheng'

    xuesheng_id = Column(Integer, primary_key=True, index=True)
    weid = Column(Integer, nullable=False)
    uidht = Column(Integer, nullable=False)
    school_id = Column(Integer, nullable=False)
    nianfen_id = Column(Integer, nullable=False)
    banji_id = Column(Integer, nullable=False)
    banjixs_id = Column(Integer, nullable=False)
    xiaozu_id = Column(Integer, nullable=False)
    xiaozuxs_id = Column(Integer, nullable=False)
    sflx = Column(Integer, nullable=False)
    bjcsjf = Column(Float, nullable=False, server_default=text("'0.00'"))
    bjzf = Column(Float, nullable=False, server_default=text("'0.00'"))
    displayorder = Column(Integer, nullable=False)
    pic = Column(Text, nullable=False)
    sex = Column(Text, nullable=False)
    jiguan = Column(Text, nullable=False)
    minzu = Column(Text, nullable=False)
    sfzhm = Column(Text, nullable=False)
    qq = Column(String(255), nullable=False)
    phone = Column(String(255), nullable=False)
    yzm = Column(String(225), nullable=False)
    updatetime = Column(Integer, nullable=False)
    beizhu = Column(Text, nullable=False)
    addtime = Column(Integer, nullable=False)
    openid = Column(String(255), nullable=False)
    openid1 = Column(String(255), nullable=False)
    openid2 = Column(String(255), nullable=False)
    openid3 = Column(String(255), nullable=False)
    openid4 = Column(String(255), nullable=False)
    openid5 = Column(String(255), nullable=False)
    openid6 = Column(String(255), nullable=False)
    openid7 = Column(String(255), nullable=False)
    openid8 = Column(String(255), nullable=False)
    sflx1 = Column(Integer, nullable=False)
    sflx2 = Column(Integer, nullable=False)
    sflx3 = Column(Integer, nullable=False)
    sflx4 = Column(Integer, nullable=False)
    sflx5 = Column(Integer, nullable=False)
    sflx6 = Column(Integer, nullable=False)
    sflx7 = Column(Integer, nullable=False)
    sflx8 = Column(Integer, nullable=False)
    nid = Column(Integer, nullable=False)
    name = Column(String(50), nullable=False)
    parentid = Column(Integer, nullable=False)
    enabled = Column(Integer, nullable=False)
    icon = Column(String(100), nullable=False)
    description = Column(String(100), nullable=False)
    styleid = Column(Integer, nullable=False)
    linkurl = Column(String(500), nullable=False)
    ishomepage = Column(Integer, nullable=False)
    icontype = Column(Integer, nullable=False)
    css = Column(String(500), nullable=False)
    student_name = Column(CHAR(20), nullable=True)
    gxuehao = Column(CHAR(25), nullable=True)
    xxuehao = Column(CHAR(25), nullable=True)
    zxxuehao = Column(CHAR(25), nullable=True)
    student_img = Column(CHAR(60), nullable=True)
    parent_name = Column(CHAR(20), nullable=True)
    parent_phone = Column(CHAR(20), nullable=True)
    address = Column(String(255), nullable=True)
    uid = Column(Integer, nullable=True, server_default=text("'0'"))
    uid1 = Column(Integer, nullable=True, server_default=text("'0'"))
    uid2 = Column(Integer, nullable=True, server_default=text("'0'"))
    uid3 = Column(Integer, nullable=True, server_default=text("'0'"))
    uid4 = Column(Integer, nullable=True, server_default=text("'0'"))
    uid5 = Column(Integer, nullable=True, server_default=text("'0'"))
    uid6 = Column(Integer, nullable=True, server_default=text("'0'"))
    uid7 = Column(Integer, nullable=True, server_default=text("'0'"))
    uid8 = Column(Integer, nullable=True, server_default=text("'0'"))

    class Config:
        orm_mode = True
